package main

import (
	"fmt"
	"net/http"
)

type MyHandler struct{}

func (this *MyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "通过结构体实现ServeHttp方法，然后通过http.Handler来调用")
}
func main() {
	myHandler := MyHandler{}
	http.Handle("/", &myHandler)
	http.ListenAndServe(":8080", nil)
}
